import Vue from 'vue'
import VueRouter from 'vue-router'
import view from '@/router/view.vue'

Vue.use(VueRouter)

/* 页面整体布局模块 */

const routes = [
  {
    path: '/',
    redirect: '/home',
    meta: { title: '首页', icon: 'dashboard', auth: 'public' },
    component: view,
    children: [
      {
        path: '/home',
        component: () => import('@/views/home'),
        meta: { title: '首页', icon: 'dashboard', auth: 'public' }
      }
    ]
  },
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  scrollBehavior: () => ({ y: 0 }),
  routes
})
router.beforeEach(async(to, from, next) => {
  next()
})
export default router
